<template>
  <view>
    <BackgroundBar title="海岛" :back="true"></BackgroundBar>
    <view v-for="(item, index) of list" :key="index" @click="goDetail(item)">
      <ListItem :item="item"></ListItem>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue';
import BackgroundBar from '@/components/NavigationBar/background.vue';
import ListItem from './components/ListItem.vue';

import articleManagement from '@/api/articleManagement.js';

const list = ref([]);

const goDetail = (item) => {
  console.log("goDetail",item)
  if (item.messageType === 'FOLLOW') {
    uni.navigateTo({ url: `/pages/my/fans/index` });
    return;
  }
  const itemParams = JSON.stringify(item);
  uni.navigateTo({ url: `/pages/message/detail?item=${itemParams}` });
};

articleManagement.getAllMessage().then((res) => {
  console.log("getAllMessage",res)
  list.value = res.data;
});
</script>

<style lang="scss"></style>
